/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hcbamk.atm.controllers;

import com.hcbank.classes.Account;
import com.hcbank.sessionbeans.AccountSessionBeanRemote;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author NHAHV
 */
public class AccountController {
    AccountSessionBeanRemote accountSessionBeanRemote;

    public AccountController() {
        accountSessionBeanRemote = lookupAccountSessionBeanRemote();
    }
    
    public Account ATMLogin(String Number, String PIN){
      
        Account ATMLogin = accountSessionBeanRemote.ATMLogin(Number, "123");
        return ATMLogin;
        
       
    }

    private AccountSessionBeanRemote lookupAccountSessionBeanRemote() {
        try {
            Context c = new InitialContext();
            return (AccountSessionBeanRemote) c.lookup("java:comp/env/AccountSessionBean");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
    
    

   

    

   
}
